package com.example.duihua.mapper;

import com.example.duihua.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface UserMapper {
    
    User findByUsername(String username);
    
    User findByEmail(String email);
    
    User findById(Long id);
    
    int insert(User user);
    
    int update(User user);
    
    int updateStatus(@Param("userId") Long userId, @Param("status") String status);
    
    int updateLastLoginTime(@Param("userId") Long userId, @Param("lastLoginTime") java.time.LocalDateTime lastLoginTime);
    
    User findByUsernameOrEmail(String usernameOrEmail);
    
    boolean existsByUsername(String username);
    
    boolean existsByEmail(String email);
    
    java.util.List<User> searchUsers(String keyword);
    
    java.util.List<User> findOnlineUsers();
    
    // 添加缺失的方法
    int countByUsername(String username);
    
    int updateProfile(User user);
    
    java.util.List<User> findAll();
}
